import 'package:flutter/material.dart';

void main() {
  // 1. 运行应用程序。
  runApp(const MaterialApp(
    home: Main(),
  ));
}

class Main extends StatelessWidget {
  const Main({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text(
          'ListView组件 - 1.基础用法',
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.purple,
      ),
      body: ListView(
        scrollDirection: Axis.vertical,
        // reverse: true, // 翻转
        // physics: const NeverScrollableScrollPhysics(), // 禁止滚动
        children: [
          Container(
            height: 100,
            color: Colors.red,
            child: const Text('子元素1'),
          ),
          Container(
            height: 200,
            color: Colors.green,
            child: const Text('子元素2'),
          ),
          Container(
            height: 300,
            color: Colors.blue,
            child: const Text('子元素3'),
          ),
          Container(
            height: 400,
            color: Colors.yellow,
            child: const Text('子元素4'),
          ),
          Container(
            height: 500,
            color: Colors.orange,
            child: const Text('子元素5'),
          ),
        ],
      ),
    );
  }
}
